import request from '@/utils/request'

export function setDefaultStatus(id, token) {
  return request({
    url: `/api/member/reception/address/setDefaultStatus`,
    method: 'get',
    params: {id: id, token: token}
  })
}

export function addAddress(query) {
  return request({
    url: '/api/member/reception/address/addAddress',
    method: 'post',
    data: query
  })
}

export function updateAddress(query) {
  return request({
    url: '/api/member/reception/address/updateAddress',
    method: 'post',
    data: query
  })
}

export function deleteAddress(id) {
  return request({
    url: `/api/member/reception/address/deleteAddress/${id}`,
    method: 'get'
  })
}

export function infoAddress(id) {
  return request({
    url: `/api/member/reception/address/infoAddress/${id}`,
    method: 'get'
  })
}

export function isExistUsername(username) {
  return request({
    url: '/api/member/reception/isExistUsername',
    method: 'get',
    params: username
  })
}

export function isExistPhone(phone) {
  return request({
    url: '/api/member/reception/isExistPhone',
    method: 'get',
    params: phone
  })
}

export function login(query) {
  return request({
    url: '/api/member/reception/login',
    method: 'post',
    data: query
  })
}

export function giteeLogin(code) {
  return request({
    url: '/api/member/reception/giteeLogin',
    method: 'get',
    params: code
  })
}


export function sendCode(phone) {
  return request({
    url: `/api/member/reception/sms/sendCode`,
    method: 'get',
    params: phone
  })
}

export function register(query) {
  return request({
    url: `/api/member/reception/register`,
    method: 'post',
    data: query
  })
}

export function getCurrentUser(token) {
  return request({
    url: `/api/member/reception/getCurrentUser`,
    method: 'post',
    data: token
  })
}

export function saveCurrentUser(query) {
  return request({
    url: `/api/member/reception/saveCurrentUser`,
    method: 'post',
    data: query
  })
}

